#if !defined(AFX_MAINWINDOW_H__6FCF7D18_881C_4EEB_B671_0740ACC434D3__INCLUDED_)
#define AFX_MAINWINDOW_H__6FCF7D18_881C_4EEB_B671_0740ACC434D3__INCLUDED_

#include "hsv.h"	// Added by ClassView
#define LPARAM long
#define DWORD_PTR unsigned int
#include <vfw.h>
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// MainWindow.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CMainWindow window
#define WS_EX_LAYERED           0x00080000
//#define AC_SRC_OVER				0x00000000; 
#define AC_SRC_ALPHA			0x00000001; 
//#define AC_SRC_NO_PREMULT_ALPHA 0x00000001; 
//#define AC_SRC_NO_ALPHA			0x00000002; 
//#define AC_DST_NO_PREMULT_ALPHA 0x00000010; 
//#define AC_DST_NO_ALPHA			0x00000020; 
#define LWA_COLORKEY			0x00000001; 
#define LWA_ALPHA				0x00000002; 
#define ULW_COLORKEY			0x00000001 
#define ULW_ALPHA				0x00000002 
#define ULW_OPAQUE				0x00000004
typedef BOOL (WINAPI *lpfnUpdateLayeredWindow)(HWND hWnd, HDC hdcDst, POINT *pptDst, SIZE *psize, HDC hdcSrc, POINT *pptSrc, COLORREF crKey, BLENDFUNCTION *pblend, DWORD dwFlags);
typedef BOOL (WINAPI *lpfnSetLayeredWindowAttributes)(HWND hWnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags);
typedef BOOL (WINAPI *lpfnAlphaBlend)(HDC hdcDest,int nXOriginDest,int nYOriginDest,int nWidthDest,int nHeightDest,HDC hdcSrc,int nXOriginSrc,int nYOriginSrc,int nWidthSrc,int nHeightSrc,BLENDFUNCTION blendFunction);
class CMainWindow : public CWnd
{
// Construction
public:
	CMainWindow();

// Attributes
public:
	bool bMoveingWindow;
	CPoint LastMousePoint;

// Operations
public:
	lpfnUpdateLayeredWindow pUpdateLayeredWindow;
	lpfnSetLayeredWindowAttributes pSetLayeredWindowAttributes;
	lpfnAlphaBlend pAlphaBlend2;
	AVISTREAMINFO		psi;										// Pointer To A Structure Containing Stream Info
	PAVISTREAM			pavi;										// Handle To An Open Stream
	PGETFRAME			pgf;										// Pointer To A GetFrame Object
	AVISTREAMINFO		pasi;										// Pointer To A Structure Containing Stream Info
	PAVISTREAM			paavi;										// Handle To An Open Stream
	PGETFRAME			pagf;										// Pointer To A GetFrame Object
	int					frame;
	long				lastframe;									// Last Frame Of The Stream
	int					width;										// Video Width
	int					height;										// Video Height
	char				*pdata;										// Pointer To Texture Data
	char				*padata;										// Pointer To Texture Data
	HDRAWDIB hdd;													// Handle For Our Dib
	void flipIt(void* buffer);				// Flips The Red And Blue Bytes (256x256)
	BOOL OpenAVI(LPCSTR szFile,LPCSTR szAlphaFile);			// Opens An AVI File (szFile)
	void GrabAVIFrame(int frame);			// Grabs A Frame From The Stream
	void CloseAVI(void);						// Properly Closes The Avi File


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMainWindow)
	protected:
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	//}}AFX_VIRTUAL

// Implementation
public:
	int dx;
	float an;
	short d;
	int nMethod;
	SYSTEMTIME stCurrentTime;
	SYSTEMTIME stTimeLimit;
	SYSTEMTIME stStartTime;
	hsv hsv;
	void DrawAlarmLight(float angle,float halfwidth);
	void DrawRadiationAlarm(int angle);
	UINT nTimeCount;
	UINT nFps;
	HDC hScreenDC;
	HDC hBackBufferDC;
	HBITMAP hBackBufferBitmap;
	HBITMAP hOldBitmap;
	PBYTE pBits,pTemp;
	PBYTE pAlpha;
	SIZE Size;
	POINT ptDst;
	POINT ptSrc;
	BLENDFUNCTION Blend;
	virtual ~CMainWindow();

	// Generated message map functions
protected:
	afx_msg void OnContextMenu(CWnd*, CPoint point);
	//{{AFX_MSG(CMainWindow)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void OnMoving(UINT fwSide, LPRECT pRect);
	afx_msg void OnMove(int x, int y);
	afx_msg void OnDropFiles(HDROP hDropInfo);
	afx_msg void OnDestroy();
	afx_msg void OnMenuitemExit();
	afx_msg void OnMenuitemMethod1();
	afx_msg void OnMenuitemMethod2();
	afx_msg void OnMenuitemMethod3();
	afx_msg void OnNcDestroy();
	afx_msg void OnMenuitemMethod4();
	afx_msg void OnMenuitemAbout();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_MAINWINDOW_H__6FCF7D18_881C_4EEB_B671_0740ACC434D3__INCLUDED_)
